package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

public class HWBJ14 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int total = Integer.parseInt(scanner.nextLine());

        int m = Integer.parseInt(scanner.nextLine());

        String s = scanner.nextLine();

        int k = Integer.parseInt(scanner.nextLine());
        
        int[] nums = new int[total];

        Arrays.fill(nums, 1);
        String[] strs = s.split(" ");
        for (String str : strs) {
            nums[Integer.parseInt(str)-1] = 0;
        }
        
        int l = 0;
        int t = 0;
        int max = 0;
        for (int r = 0; r < nums.length; r++) {
            if (nums[r] == 0){
                t++;
            }
            while (t > k) {
                if (nums[l]==0) {
                    t--;
                }
                l++;
            }
            max = Math.max(max,r-l+1);
        }
        System.out.println(max);
    }
}
